package cn.itcast.bos.system.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import cn.itcast.bos.domain.security.Role;

public interface RoleDao extends JpaRepository<Role, Integer>{

	@Query("from Role r inner join fetch r.users u where u.id=:id")
	List<Role> getRolesByUserId(@Param("id")int id);

	@Query("from Role r where r.id in :roleIds")
	List<Role> getByIds(@Param("roleIds")Integer[] roleIds);

}
